import { dateFormat } from '@/util/date';
export const startDate = dateFormat(new Date(), 'yyyy-MM-') + '01 00:00:00';
let now = new Date();
now.setDate(now.getDate() + 1);
export const endDate = dateFormat(now, 'yyyy-MM-dd') + ' 00:00:00';
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  dialogWidth:'70%',
  labelWidth: 140,
  viewBtn: true,
  delBtn: false,
  editBtn: false,
  selection: true,
  selectable: row => {
    return row.isSend == '0'|| row.isSend =='1'
  },
  //selectable:true,
  searchMenuSpan: 6,
  column: [{
    label: '标识',
    prop: 'id',
    hide: true,
    display: false
  },{
    label: '计划类型',
    prop: 'planType',
    type: 'select',
    dicData: [{
      label: '配送计划',
      value: '3'
    }, {
      label: '回收计划',
      value: '4'
    }],
    rules: [{
      required: true,
      message: '请选择计划类型',
      trigger: 'blur'
    }]
  }, {
    label: '线路',
    prop: 'lineCode',
    type: 'select',
    cascaderItem: ["stationCode"],
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/support/swparamline/dict",
    search: true,
    rules: [{
      required: true,
      message: '请选择线路',
      trigger: 'blur'
    }]
  }, {
    label: '车站',
    prop: 'stationCode',
    type: 'select',
    dicUrl: "/support/swparamstation/dict/{{key}}",
    props: {
    	label: 'name',
    	value: 'code'
    },
    dicFlag: false,
    search: true,
    rules: [{
      required: true,
      message: '请选择车站',
      trigger: 'blur'
    }]
  }, {
    label: '票种',
    prop: 'ticketType',
    type: 'select',
    search: true,
    dicUrl: '/support/swpmticketcardtype/dict',
    props: {
      label: 'mainName',
      value: 'mainEnName'
    },
    cascaderItem: ["ticketName"],
    rules: [{
      required: true,
      message: '请选择票种',
      trigger: 'blur'
    }]
  }, {
    label: '车票名称',
    prop: 'ticketName',
    props: {
      label: 'subName',
      value: 'subEnName'
    },
    type: 'select',
    dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
    dicFlag: false,
    component: 'ticket-name-select',
    params: {
      ticketAmountKey: 'ticketPrice',
      ticketCountKey: 'ticketTimes'
    },
    search: true,
    rules: [{
      required: true,
      message: '请选择车票名称',
      trigger: 'blur'
    }]
  }, {
    label: '票价',
    prop: 'ticketPrice',
    type: 'number',
    precision: 2,
    disabled: true
  }, {
    label: '车票次数',
    prop: 'ticketTimes',
    type: 'number',
    disabled: true
  }, {
    label: '张数',
    prop: 'ticketNumber',
    type: 'number',
    //row: true,
    rules: [{
      required: true,
      message: '请输入车票张数',
      trigger: 'blur'
    }]
  }, {
    label: '计划开始时间',
    prop: 'planStartTime',
    type: 'date',
    search: true,
    searchValue: startDate, 
    searchLabelWidth: 100,
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    rules: [{
      required: true,
      message: '请选择计划开始时间',
      trigger: 'blur'
    }]
  }, {
    label: '计划结束时间',
    prop: 'planEndTime',
    type: 'date',
    search: true,
    searchValue: endDate, 
    searchLabelWidth: 100,
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    rules: [{
      required: true,
      message: '请选择计划结束时间',
      trigger: 'blur'
    }]
  }, {
    label: '下发状态',
    prop: 'isSend',
    type: 'select',
    display: false,
    search: true,
    searchValue: '0',
    dicData: [{
      label: '未下发',
      value: '0'
    }, {
      label: '已下发',
      value: '1'
    }]
  }, {
    label: '审批状态',
    prop: 'checkStatus',
    type: 'select',
    dicUrl: '/admin/dict/type/check_status',
    hide: true,
    display: false
  }, {
    label: '审核时间',
    prop: 'checkTime',
    hide: true,
    display: false
  }, {
    label: '备注',
    prop: 'remark',
    type: 'textarea',
    span: 24,
    maxRows:6,
    minRows:4
  }, {
    dataType: 'string',
    "type": "upload",
    "label": "普通附件",
    "prop": "filePath",
    component: "zd-upload",
    hide: true,
    limit: 1
  }, {
    dataType: 'string',
    "type": "upload",
    "label": "图片附件",
    "prop": "picturePath",
    listType: 'picture-img',
    component: "zd-upload",
    hide: true,
    limit: 1
  }, {
    label: '创建人ID',
    prop: 'creatorId',
    hide: true,
    display: false
  }, {
    label: '创建人名称',
    prop: 'creatorName',
    hide: true,
    display: false
  }, {
    label: '创建时间',
    prop: 'createtime',
    hide: true,
    display: false
  }]
};
